home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / olecon~1 / controls / template / templctl.h < prev    next >
Text File  |  1995-11-25  |  4KB  |  113 lines

  1. //=--------------------------------------------------------------------------=
  2. // <<DEFCONTROLTRUNCNAME>>Ctl.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright  1995  Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // class declaration for the <<DEFCONTROLNAME>> control.
  13. //
  14. #ifndef _<<DEFCONTROLNAMECAPS>>CONTROL_H_
  15.  
  16. #include "IPServer.H"
  17. #include "CtrlObj.H"
  18. #include "<<DEFCONTROLNAME>>Interfaces.H"
  19. #include "Dispids.H"
  20.  
  21. typedef struct tag<<DEFCONTROLNAMECAPS>>CTLSTATE {
  22.  
  23.     // TOOD: put state variables here, and probably get rid of fGarbage, unless
  24.     // you have a real need for it
  25.     //
  26.     VARIANT_BOOL fGarbage;
  27.  
  28. } <<DEFCONTROLNAMECAPS>>CTLSTATE;
  29.  
  30. //=--------------------------------------------------------------------------=
  31. // C<<DEFCONTROLNAME>>Control
  32. //=--------------------------------------------------------------------------=
  33. // our control.
  34. //
  35. class C<<DEFCONTROLNAME>>Control : public COleControl, public I<<DEFCONTROLNAME>>, public ISupportErrorInfo {
  36.  
  37.   public:
  38.     // IUnknown methods
  39.     //
  40.     DECLARE_STANDARD_UNKNOWN();
  41.  
  42.     // IDispatch methods
  43.     //
  44.     DECLARE_STANDARD_DISPATCH();
  45.  
  46.     // ISupportErrorInfo methods
  47.     //
  48.     DECLARE_STANDARD_SUPPORTERRORINFO();
  49.  
  50.     // I<<DEFCONTROLNAME>> methods
  51.     //
  52.     // TODO: copy over the method declarations from <<DEFCONTROLNAME>>Interfaces.H
  53.     //       don't forget to remove the PURE from them.
  54.     //
  55.     STDMETHOD_(void, AboutBox)(THIS);
  56.  
  57.     // OLE Control stuff follows:
  58.     //
  59.     C<<DEFCONTROLNAME>>Control(IUnknown *pUnkOuter);
  60.     virtual ~C<<DEFCONTROLNAME>>Control();
  61.  
  62.     // static creation function.  all controls must have one of these!
  63.     //
  64.     static IUnknown *Create(IUnknown *);
  65.  
  66.   private:
  67.     // overridables that the control must implement.
  68.     //
  69.     STDMETHOD(LoadBinaryState)(IStream *pStream);
  70.     STDMETHOD(SaveBinaryState)(IStream *pStream);
  71.     STDMETHOD(LoadTextState)(IPropertyBag *pPropertyBag, IErrorLog *pErrorLog);
  72.     STDMETHOD(SaveTextState)(IPropertyBag *pPropertyBag, BOOL fWriteDefault);
  73.     STDMETHOD(OnDraw)(HDC hdcDraw, LPCRECTL prcBounds, LPCRECTL prcWBounds, HDC hicTargetDev);
  74.     virtual LRESULT WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  75.     virtual BOOL    RegisterClassData(void);
  76.  
  77.     virtual HRESULT InternalQueryInterface(REFIID, void **);
  78.     virtual void    BeforeCreateWindow(void);
  79.  
  80.     // private state information.
  81.     //
  82.     <<DEFCONTROLNAMECAPS>>CTLSTATE m_state;
  83. };
  84.  
  85.  
  86. // TODO: if you have an array of verbs, then add an extern here with the name
  87. //       of it, so that you can include it in the DEFINE_CONTROLOBJECT.
  88. //       ie.  extern VERBINFO m_<<DEFCONTROLNAME>>CustomVerbs [];
  89. //
  90. extern const GUID    *rg<<DEFCONTROLNAME>>PropPages [];
  91. DEFINE_CONTROLOBJECT(<<DEFCONTROLNAME>>,
  92.     &CLSID_<<DEFCONTROLNAME>>,
  93.     "<<DEFCONTROLNAME>>Ctl",
  94.     C<<DEFCONTROLNAME>>Control::Create,
  95.     1,
  96.     &IID_I<<DEFCONTROLNAME>>,
  97.     "<<DEFCONTROLNAME>>.HLP",
  98.     &DIID_D<<DEFCONTROLNAME>>Events,
  99.     OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_RECOMPOSEONRESIZE|OLEMISC_CANTLINKINSIDE|OLEMISC_INSIDEOUT,
  100.     RESID_TOOLBOX_BITMAP,
  101.     "<<DEFCONTROLNAME>>WndClass",
  102.     1,
  103.     rg<<DEFCONTROLNAME>>PropPages,
  104.     0,
  105.     NULL);
  106.  
  107.  
  108.  
  109. #define _<<DEFCONTROLNAMECAPS>>CONTROL_H_
  110. #endif // _<<DEFCONTROLNAMECAPS>>CONTROL_H_
  111.  
  112.  
  113.